package com.fy.common.util;


import org.springframework.util.StringUtils;

import java.util.Locale;

public class LocaleUtil {
    /**
     * 解析并返回Local
     * @param lan
     * @return
     */
    public static Locale resolveLocale(String lan) {
//        Locale locale = Locale.getDefault();
        Locale locale = new Locale("en", "US");
        if (StringUtils.hasLength(lan)) {
            String[] split = lan.split("_");
            // 国家、地区
            locale = new Locale(split[0], split[1]);
        }
        return locale;
    }
}
